package com.xuan.core.controller.pg;

import com.xuan.core.configuration.result.ResponseResult;
import com.xuan.core.configuration.result.ResponseResultEnum;
import com.xuan.core.dto.pg.PgBaZiDto;
import com.xuan.core.service.pg.PgBaZiService;
import com.xuan.core.vo.pg.PgBaZiVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 八字排盘Controller
 */
@RestController
@RequestMapping("/pgBaZi")
public class PgBaZiController {

    @Autowired
    private PgBaZiService pgBaZiService; // 八字排盘Service

//********************************************************************************************************************************

    /**
     * 开始排盘
     *
     * @param dto 八字排盘数据接收类
     * @return 排盘结果
     */
    @PostMapping("/starts")
    @Cacheable(
            value = "pgBaZiStarts",
            key = "'_' + #dto.name + #dto.occupy + #dto.sex + #dto.date.year + #dto.date.month + #dto.date.day + #dto.date.hours + " +
                    "#dto.date.minutes + #dto.dateType + #dto.address + #dto.leapMonth + #dto.qiYunLiuPai + #dto.yearGanZhiSet + " +
                    "#dto.monthGanZhiSet + #dto.dayGanZhiSet + #dto.hourGanZhiSet + #dto.xueTangSet + #dto.ciGuanSet + #dto.daYunLun"
    )
    public ResponseResult<PgBaZiVo> starts(@RequestBody PgBaZiDto dto) {

        PgBaZiVo vo = pgBaZiService.starts(dto);
        return ResponseResult.result(ResponseResultEnum.SUCCESS, vo);

    }


}
